import { injectable } from 'inversify';
import { makeAutoObservable, runInAction } from 'mobx';
import { RoleEntity } from './role.entity.ts';

@injectable()
export class RoleItemModel {
  private _role: RoleEntity = new RoleEntity();
  private _loading = false;

  get role() {
    return this._role;
  }

  set role(value: RoleEntity) {
    runInAction(() => {
      this._role = value;
    });
  }

  get loading() {
    return this._loading;
  }

  set loading(value: boolean) {
    this._loading = value;
  }

  constructor() {
    makeAutoObservable(this);
  }

  dispose() {
    this._role = new RoleEntity();
  }
}
